$("#initEquipmentSelfCheck").click(function(){
	   //var load_index = layer.load(1, {shade: [0.1,'#fff'],scrollbar: false});
	   var load_index = layer.msg('加载中', {icon: 16,shade: 0.01,scrollbar: false});
	   $.get(base+"/projectCenter/businessdata/initEquipmentSelfCheck/"+project_id, function(result){
		   layer.close(load_index);
		   layer.msg('设备自检成功!', {icon: 1,time:2000});
		   initData(1);
	   });
});

var initData = function(num){
    var param = {
		page_num:num,
		page_size:"10",
		project_id:project_id
    }
	$.ajax({
        url: base + "/projectCenter/businessdata/initEquipmentSelfCheckResult",
        data: param,
        success: function (data, textStatus, jqXHR) {
        	if(data != null){
	        	var pageCount = data.pager.pageCount;
	        	var dataObj ={
	        			"list":data.list,
	         			"dataTool":{
	         				"title":{
	          			      	"equipment_selfcheck_xmmc": "自检项目名称"
	          			      	,"result": "自检结果"
	          			      	,"reason":"不通过原因"
	          			      	,"create_time":"创建时间"
	          			      	,"update_time":"修改时间"
	            			},
	            			"titleCheckbox":false
						}
		  		};
	        	var data_list = dataObj.list;
	        	for(var i=0;i<data_list.length;i++){
	        		var data_obj = data_list[i];
	        		var result = data_obj.result;
	        		if("自检通过" == result){
	        			data_obj.result = '<span class="self-examination-pass"><img src='+base+'/images/pass.png alt=""> &nbsp;自检通过</span>';
	        		}else{
	        			data_obj.result = '<span class="self-examination-fail"><img src='+base+'/images/fail.png alt=""> &nbsp;自检不通过</span>';
	        		}
	        	}
	        	showPageTable('view', dataObj,num,pageCount,"initData");
        	}
        },
        error: function () {
        }
    });
}

$(function(){
	initData(1);
})